package o;

import android.app.Activity;
import com.huawei.appgallery.forum.base.ui.ForumActivity;
import java.lang.ref.WeakReference;
import java.util.ArrayList;

public interface bsa {
    public static final bsa ˊ = new bsa() {
        private ArrayList<WeakReference<Activity>> ॱ = new ArrayList();

        public void ˋ() {
            djk.ˋ().ˎ(ForumActivity.class);
        }

        public int ॱ() {
            return 10;
        }

        public void ˋ(ForumActivity forumActivity) {
            if (this.ॱ.size() >= ॱ()) {
                Activity activity = (Activity) ((WeakReference) this.ॱ.get(0)).get();
                if (activity != null) {
                    bqx.ˊ("ForumActivityController", "ready to remove:" + activity);
                    activity.finish();
                }
            }
            this.ॱ.add(new WeakReference(forumActivity));
        }

        public void ˎ(ForumActivity forumActivity) {
            int ˏ = ˏ(forumActivity);
            if (ˏ != -1) {
                this.ॱ.remove(ˏ);
            }
        }

        private int ˏ(ForumActivity forumActivity) {
            int size = this.ॱ.size();
            for (int i = 0; i < size; i++) {
                if (((Activity) ((WeakReference) this.ॱ.get(i)).get()) == forumActivity) {
                    return i;
                }
            }
            return -1;
        }
    };

    void ˋ();

    void ˋ(ForumActivity forumActivity);

    void ˎ(ForumActivity forumActivity);
}
